import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
// const {ipcRenderer} = window.require('electron')
const ipcRenderer = window.ipcRenderer
router.beforeEach((to,from,next)=>{
  if(from.name === 'chatPage'){
    if(store.state.socket){
      store.state.socket.close()
    }
  }
  ipcRenderer.send('skip',to.name)
  next()
})
Vue.config.productionTip = false
Vue.prototype.ipcRenderer = ipcRenderer
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
